home *** CD-ROM | disk | FTP | other *** search
/ Collection of Tools & Utilities / Collection of Tools and Utilities.iso / turbovis / tvtool17.zip / CALENDAR.H < prev    next >
C/C++ Source or Header  |  1993-01-14  |  2KB  |  90 lines

  1. /*-------------------------------------------------------*/
  2. /*                                                       */
  3. /*   Calendar.h: Header file for Calendar.cpp            */
  4. /*-------------------------------------------------------*/
  5.  
  6. #if ! defined( __CALENDAR_H ) && defined(Uses_TCalendar)
  7. #define __CALENDAR_H
  8.  
  9.  
  10. class TRect;
  11. class TEvent;
  12.  
  13. class TCalendarView : public TView
  14. {
  15.  
  16. public:
  17.  
  18.     TCalendarView(TRect & r);
  19.     TCalendarView( StreamableInit ) : TView(streamableInit) { };
  20.     virtual void handleEvent(TEvent& event);
  21.     virtual void draw();
  22.  
  23. private:
  24.  
  25.     unsigned days, month, year;
  26.     unsigned curDay, curMonth, curYear;
  27.  
  28.     virtual const char *streamableName() const
  29.         { return name; }
  30.  
  31. protected:
  32.  
  33.     virtual void write( opstream& );
  34.     virtual void *read( ipstream& );
  35.  
  36. public:
  37.  
  38.     static const char * const name;
  39.     static TStreamable *build();
  40. };
  41.  
  42. inline ipstream& operator >> ( ipstream& is, TCalendarView& cl )
  43.     { return is >> (TStreamable&) cl; }
  44. inline ipstream& operator >> ( ipstream& is, TCalendarView*& cl )
  45.     { return is >> (void *&) cl; }
  46.  
  47. inline opstream& operator << ( opstream& os, TCalendarView& cl )
  48.     { return os << (TStreamable&) cl; }
  49. inline opstream& operator << ( opstream& os, TCalendarView* cl )
  50.     { return os << (TStreamable *) cl; }
  51.  
  52.  
  53. class TCalendar : public TWindow
  54. {
  55.  
  56. public:
  57.  
  58.     TCalendar();
  59.     TCalendar( StreamableInit ) :
  60.         TWindow(streamableInit), TWindowInit(&TCalendar::initFrame) { };
  61.  
  62. private:
  63.  
  64.     virtual const char *streamableName() const
  65.         { return name; }
  66.  
  67. protected:
  68.  
  69.     virtual void write( opstream& );
  70.     virtual void *read( ipstream& );
  71.  
  72. public:
  73.  
  74.     static const char * const name;
  75.     static TStreamable *build();
  76.  
  77. };
  78.  
  79. inline ipstream& operator >> ( ipstream& is, TCalendar& cl )
  80.     { return is >> (TStreamable&) cl; }
  81. inline ipstream& operator >> ( ipstream& is, TCalendar*& cl )
  82.     { return is >> (void *&) cl; }
  83.  
  84. inline opstream& operator << ( opstream& os, TCalendar& cl )
  85.     { return os << (TStreamable&) cl; }
  86. inline opstream& operator << ( opstream& os, TCalendar* cl )
  87.     { return os << (TStreamable *) cl; }
  88.  
  89. #endif      // __CALENDAR_H
  90.